{{- if or .Values.istio.federation.enabled .Values.istio.multicluster.enabled }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: alliance-metadata-exporter
  namespace: d8-{{ $.Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "metadata-exporter")) | nindent 2 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: d8:istio:alliance:metadata-exporter
  {{- include "helm_lib_module_labels" (list . (dict "app" "metadata-exporter")) | nindent 2 }}
rules:
- apiGroups: [""]
  resources:
  - services
  - pods
  - nodes
  verbs:
  - get
  - list
  - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: d8:istio:alliance:metadata-exporter
  {{- include "helm_lib_module_labels" (list . (dict "app" "metadata-exporter")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: d8:istio:alliance:metadata-exporter
subjects:
- kind: ServiceAccount
  name: alliance-metadata-exporter
  namespace: d8-{{ $.Chart.Name }}
{{- end }}
